var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, n) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var n in t)
              Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
          })(t, n);
      };
      return function (t, n) {
        function r() {
          this.constructor = t;
        }
        if ("function" != typeof n && null !== n)
          throw new TypeError(
            "Class extends value " + String(n) + " is not a constructor or null"
          );
        e(t, n),
          (t.prototype =
            null === n
              ? Object.create(n)
              : ((r.prototype = n.prototype), new r()));
      };
    })(),
  FriendMomentView = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.selIndex = -1),
        (t.onLoadSearchFriendDataFn = {
          caller: t,
          code: 1165,
          method: function (e) {
            (t.friendsDataArr = []),
              (t.tab_friendMoment.selectedIndex = -1),
              (t.listArr = e.list);
            for (var n, r = 0; r < e.list.length; r++)
              (n = {
                friendName: { text: e.list[r].name },
                remark_label: { text: e.list[r].remake },
              }),
                t.friendsDataArr.push(n);
            t.list_friendMoment.dataSource = t.friendsDataArr;
          },
        }),
        (t.onLoadFriendMomentDataFn = {
          caller: t,
          code: 1160,
          method: function (e) {
            (t.friendsDataArr = []),
              (t.listArr = e.list),
              (t.label_currentTitle.text = "好友 " + e.more);
            for (var n, r = 0; r < e.list.length; r++)
              (n = {
                friendName: { text: e.list[r].name },
                remark_label: { text: e.list[r].remake },
              }),
                t.friendsDataArr.push(n);
            (t.list_friendMoment.visible = !0),
              (t.list_friendMoment.dataSource = t.friendsDataArr);
          },
        }),
        (t.onLoadFriendRecentlyDataFn = {
          caller: t,
          code: 1162,
          method: function (e) {
            (t.friendsDataArr = []),
              (t.listArr = e.list),
              (t.label_currentTitle.text = "好友 " + e.more);
            for (var n, r, i = 0; i < e.list.length; i++)
              (n = {
                friendName: { text: (r = e.list[i]).name },
                remark_label: { text: r.remake ? r.remarke : "" },
              }),
                t.friendsDataArr.push(n);
            t.list_friendMoment.dataSource = t.friendsDataArr;
          },
        }),
        (t.onLoadFriendFamilyDataFn = {
          caller: t,
          code: 1163,
          method: function (e) {
            (t.friendsDataArr = []),
              (t.listArr = e.list),
              (t.label_currentTitle.text = "好友 " + e.more);
            for (var n, r = 0; r < e.list.length; r++)
              (n = {
                friendName: { text: e.list[r].name },
                remark_label: { text: e.list[r].remake },
              }),
                t.friendsDataArr.push(n);
            t.list_friendMoment.dataSource = t.friendsDataArr;
          },
        }),
        (t.onLoadFriendChourenDataFn = {
          caller: t,
          code: 1164,
          method: function (e) {
            (t.friendsDataArr = []),
              (t.listArr = e.list),
              (t.label_currentTitle.text = "好友 " + e.more);
            for (var n, r = 0; r < e.list.length; r++)
              (n = {
                friendName: { text: e.list[r].name },
                remark_label: { text: e.list[r].remake },
              }),
                t.friendsDataArr.push(n);
            t.list_friendMoment.dataSource = t.friendsDataArr;
          },
        }),
        t.btn_friend_cancle.on(Laya.Event.CLICK, t, t.onFriendComentBackPre),
        t.tab_friendMoment.on(
          Laya.Event.CLICK,
          t,
          t.onTabFriendMomentDidClickFn
        ),
        t.button_friend_sousuo.on(Laya.Event.CLICK, t, t.onFriendSouSuoResult),
        (t.list_friendMoment.selectEnable = !0),
        (t.list_friendMoment.vScrollBarSkin = ""),
        t.list_friendMoment.on(
          Laya.Event.CLICK,
          t,
          t.onDidClickFriendMomentAction
        ),
        (t.list_friendMoment.renderHandler = new Laya.Handler(
          t,
          t.UpdateFriendMomentRender
        )),
        WebSocketService.addListener(t.onLoadFriendMomentDataFn, !0),
        WebSocketService.addListener(t.onLoadFriendRecentlyDataFn, !0),
        WebSocketService.addListener(t.onLoadFriendFamilyDataFn, !0),
        WebSocketService.addListener(t.onLoadFriendChourenDataFn, !0),
        WebSocketService.addListener(t.onLoadSearchFriendDataFn),
        t
      );
    }
    return (
      __extends(t, e),
      (t.openFriendMomentView = function () {
        return (
          null == this.friendMonVC && (this.friendMonVC = new t()),
          (this.friendMonVC.list_friendMoment.visible = !1),
          WebSocketService.send({ c: 1160, d: { pageNum: 0 } }),
          this.friendMonVC
        );
      }),
      (t.prototype.onDidClickFriendMomentAction = function (e) {
        if ("" != e.target.name)
          if ("friendSendButton" != e.target.name) {
            var t = this.tab_friendMoment.selectedIndex;
            if (0 == t || -1 == t || 1 == t || 2 == t || 3 == t) {
              var n = this.listArr[this.list_friendMoment.selectedIndex].id;
              if (1e3 == n || 1001 == n) return;
              FriendsDetailDialog.showFriendDialog(n, !0);
            }
          } else {
            var r = this.listArr[this.list_friendMoment.selectedIndex];
            PrivateChatDialog.showPrivateMsgDialog(r);
          }
      }),
      (t.prototype.onFriendSouSuoResult = function () {
        if (this.text_friendsInput.text.length > 0) {
          var e = /^\d+$/.test(this.text_friendsInput.text);
          1 == e
            ? (FriendsDetailDialog.showFriendDialog(
                this.text_friendsInput.text,
                e
              ),
              (this.text_friendsInput.text = ""))
            : WebSocketService.send({
                c: 1165,
                d: { s: this.text_friendsInput.text, pageNum: 0 },
              });
        }
      }),
      (t.prototype.onTabFriendMomentDidClickFn = function (e) {
        (this.selIndex = this.tab_friendMoment.selectedIndex),
          "item0" == e.target.name
            ? WebSocketService.send({ c: 1160, d: { pageNum: 0 } })
            : "item1" == e.target.name
            ? WebSocketService.send({ c: 1162, d: { pageNum: 0 } })
            : "item2" == e.target.name
            ? WebSocketService.send({ c: 1163, d: { pageNum: 0 } })
            : "item3" == e.target.name &&
              WebSocketService.send({ c: 1164, d: { pageNum: 0 } });
      }),
      (t.prototype.UpdateFriendMomentRender = function (e, t) {
        if (!(t > this.listArr.length)) {
          var n = e.getChildByName("friend_bg");
          (n.color = "#fbfb0a"), (n.bgColor = t % 2 == 0 ? "#21225f" : null);
        }
      }),
      (t.prototype.onFriendComentBackPre = function () {
        this.removeSelf();
      }),
      t
    );
  })(ui.FriendMomentController.FriendMomentViewUI);
